package cn.zjxiliu.lib_config;

import android.content.Context;


/**
 * Created by jessie on 2018/10/27.
 */

public abstract class AbsConfigParser implements IConfigParser {

    public abstract <T> T useParser(Context context, T entity);

    @Override
    public <T> T parserConfig(Context context, Class<T> clazz) {
        try {
            T entity = clazz.newInstance();
            return this.useParser(context, entity);
        } catch (InstantiationException e) {
            e.printStackTrace();
        } catch (IllegalAccessException e) {
            e.printStackTrace();
        }
        return null;
    }
}
